package com.example.customdatedialogtest;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import java.util.Calendar;

public class MainActivity extends AppCompatActivity {
    private CustomDateDialog dialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog=new CustomDateDialog(MainActivity.this);
                Calendar calendar=Calendar.getInstance();
                dialog.setDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), new CustomDateDialog.OnDateSetListener() {
                    @Override
                    public void onDateSet(int year, int month) {
                        Toast.makeText(MainActivity.this, ""+year+month, Toast.LENGTH_LONG).show();
                    }
                });
                dialog.show();
            }
        });
    }
}